const path = require('path');
const sqlConfig = require('./sqlConfig')
console.log(sqlConfig, '------------')
module.exports = appInfo => {
  const config = {};
  // 日志输出
  config.logger = {
    dir: path.join(__dirname, '../logs'),
    appLogName: `${appInfo.name}-web.log`,
    coreLogName: 'egg-web.log',
    agentLogName: 'egg-agent.log',
    errorLogName: 'common-error.log',
    level: 'DEBUG'
  };
  // 日志分级
  // config.logrotator = {
  //   filesRotateByHour: [
  //     path.join(appInfo.root, 'logs', appInfo.name, `${appInfo.name}-web.log`),
  //   ],
  // }

  config.sequelize = {
    datasources:[{
      delegate:'model',
      dialect: 'mysql', // support: mysql, mariadb, postgres, mssql
      dialectOptions: {
        charset: 'utf8mb4',
      },
      port: 33070,
      host: '121.43.119.235',
      username: 'jrdev',
      password: 'M6KWEkE18wS9D2M',
      database: 'jinr_hd',
      connectionLimit: 50,
      timezone: '+08:00'

    },{
      delegate:'appModel',
      dialect: 'mysql', // support: mysql, mariadb, postgres, mssql
      dialectOptions: {
        charset: 'utf8mb4',
      },
      port: 33070,
      host: '121.43.119.235',
      username: 'jrdev',
      password: 'M6KWEkE18wS9D2M',
      database: 'jinr_sys',
      connectionLimit: 50,
      timezone: '+08:00'
    }]
  };

  config.redis = {
    client: {
      host: '121.43.119.235',
      port: 63790,
      password: 'JINRdev123',
      db: 254,
    },
  };
  // 主站开发机接口地址
  config.appDomain = 'http://jinrapp.dev.jinr.com'
  return config
}